<template>
    <div>
        <el-form ref="editFormRef" :model="editForm" label-width="80px">
            <el-input type="hidden" v-model="editForm.id" :disabled="true" style="display:none;"></el-input>
            <el-form-item label="角色名称" prop="roleName">
                <el-input v-model="editForm.roleName"></el-input>
            </el-form-item>
            <el-form-item label="描述信息" prop="remark">
                <el-input type="textarea" v-model="editForm.remark"></el-input>
            </el-form-item>
        </el-form>
        <div style="text-align: center;">
            <el-button type="primary" @click="add()">确 定</el-button>
            <el-button @click="closed()">取 消</el-button>
        </div>
    </div>
</template>
<script>
    import { Message } from 'element-ui'
    import roleApi from "@/api/role"
    export default {
        data () {
            return {
                editForm: {}
            }
        },
        methods: {
            closed(){
                this.$emit('closeDialog')
            },
            add(){
                roleApi.addRole(this.editForm).then(res =>{
                    Message.success(res.message)
                    this.$emit('getRoleList')
                    this.closed()
                    this.editForm = {}
                })
            }
        }
    }
</script>
